<template>
  <div class="search-results-view">
    <ul>
      <li v-for="(s,i) in searchResults" :key="i">
        <div class="type1 item" v-if="s.type===0">
          <div class="left">
            <span>#</span>
            {{s.tagInfo.tagName}}
          </div>
          <div class="join-count">{{s.tagInfo.joinCount}}参加</div>
        </div>

        <div class="type2 item" v-if="s.type===1">
          <i></i>
          <div class="left">{{s.tagInfo.tagName}}</div>
        </div>

        <div class="type3 item" v-if="s.type===2">
          <div class="user-img">
            <img :src="s.blogData.blogInfo.bigAvaImg" />
          </div>
          <div class="text">
            <div class="user-name">{{s.blogData.blogInfo.blogNickName}}</div>
            <div class="blog-info">
              <div class="id">ID: {{s.blogData.blogInfo.blogName}}</div>
              <div
                class="post"
                v-if="s.blogData.blogCount.publicPostCount"
              >文章：{{s.blogData.blogCount.publicPostCount}}</div>
              <div
                class="follower"
                v-if="s.blogData.blogCount.followerCount!==-1"
              >粉丝：{{s.blogData.blogCount.followerCount}}</div>
            </div>
          </div>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: "SearchResultsView",
  props: ["searchResults"]
};
</script>

<style lang="scss" scoped>
.search-results-view {
  width: 100vw;
  min-height: 100vh;

  ul {
    width: 94vw;
    margin: 0 auto;
    li {
      margin: 15px 0;
      padding: 0 15px;
      font-size: 14px;
      font-weight: 700;

      .item {
        width: 100%;
      }
      .type1 {
        display: flex;
        justify-content: space-between;

        .left {
          font-size: 14px;
          font-weight: 100;

          span {
            color: #c5c5c5;
            margin-right: 10px;
          }
        }
        .join-count {
          font-size: 12px;
          color: #c5c5c5;
        }
      }

      .type2 {
        display: flex;
        font-size: 14px;
        font-weight: 100;
        i {
          width: 12px;
          height: 12px;
          display: block;
          margin-right: 10px;
          background-image: url("~@/assets/images/home/search.png");
          background-repeat: no-repeat;
          background-position: center center;
          background-size: contain;
        }
      }

      .type3 {
        font-size: 14px;
        font-weight: 100;
        display: flex;

        .user-img {
          width: 30px;
          height: 30px;
          border-radius: 999px;
          margin-right: 10px;

          img {
            width: 30px;
            height: 30px;
            border-radius: 999px;
            margin-left: 0;
          }
        }

        .text {
          display: flex;
          flex-flow: column;

          .blog-info {
            display: flex;
            color: #c5c5c5;

            .id,
            .post,
            .follower {
              font-size: 12px;
              margin: 0 5px;
            }
          }
        }
      }
    }
  }
  img {
    width: 16px;
    height: 16px;
    margin-left: 10px;
  }
}
</style>